
#pragma once

#include "../Main.h"
#include "../TypedStack.h"
#include "../Widgets/Widget.h"
#include "Controller_ModalDialog.h"

#include <SDL_video.h>

class DialogPanel;
class Input;
class Panel;
class Preset;
class SDLEventHandler;
class TextureManager;
class Widget;

enum CONTROLLER_SCREEN
{
	CONTROLLER_SCREEN_NONE = 99,
	CONTROLLER_SCREEN_MAIN = 0,
	CONTROLLER_SCREEN_EDITOR = 1,
	
	CONTROLLER_NUM_SCREENS
};

class Controller_Main
{
	public:


		static void	Initialise		( Preset* pxPreset, const CONTROLLER_SCREEN eScreen );
		static void Update			( );
		static void Render			( );
		static void Shutdown		( );

		static void ChangeScreen	( const CONTROLLER_SCREEN eScreen );

        static Preset* GetCurrentPreset() { return s_pxPreset; }

		static TextureManager* GetTextureManager( ) { return s_pxTextureManager; }
		static Panel* GetWindowPanel			( ) { return s_pxWindowPanel; }
		static Input* GetInputHandler			( ) { return s_pxInputHandler; }


		static bool ShouldQuit		( )	{ return s_bShouldQuit; }
		static void Quit			( ) { s_bShouldQuit = true; }

        static unsigned int GetHeight();
        static unsigned int GetWidth();

        static void Resize( unsigned int uWidth, unsigned int uHeight );

        static u_int GetWindowID();

		static bool HandleEvent( const SDL_Event& xEvent );

		static void AddModal( Widget* pxWidget );
		static void RemoveModal( Widget* pxWidget );

	private:
		
		static TextureManager* s_pxTextureManager;
		static SDL_Window* s_pxWindow;
		static SDL_GLContext s_xContext;
		static CONTROLLER_SCREEN s_eScreen;
		static Panel* s_pxWindowPanel;
		static Input* s_pxInputHandler;
		static SDLEventHandler* s_pxEventHandler;
		static bool s_bShouldQuit;
		static unsigned int s_uTickBase;
		static float s_fFrameTime;
        static unsigned int s_uHeight;
        static unsigned int s_uWidth;
        static Preset* s_pxPreset;
		static TypedStack< Widget > s_xModalStack;
		static void Quit_PostConfirmation(Controller_ModalDialogResult eResult);

};

// eof
